import axiosServer from "@/utils/request";

/**
 * 交易中心控制-查询
 * @returns {*}
 */
export const getShopControl = () => {
    return axiosServer({
        method: "get",
        url: "/buyControl/loadByVersion",
    });
};
/**
 * 查询商品
 * @param page
 * @param limit
 * @param itemType  商品类别id  传10金币   要传
 * @param type 审核状态，默认待审核为0，审核通过为1，未通过为-1，已购买2，用户自主下架-2,已经通过后强制驳回-3
 * @param itemName // 商品名称：模糊查询
 * @returns {*}
 */
export const getShopList = (page, limit, shopType, type, itemName, hide) => {
    return axiosServer({
        method: "get",
        url: "/buy/listData",
        params: {
            page, limit, shopType, type, itemName, hide
        }
    });
};
/**
 * 交易中心控制-修改
 * @param procedures 商品手续费
 * @param selfRemovalProcedures 玩家自主下架所需手续费
 * @param displaySold 商品是否显示卖家（0不显示、1显示）默认为0
 * @param displayBuy 商品是否显示买家（0不显示、1显示）默认为0
 * @returns {*}
 */
export const updateShopControl = (procedures, selfRemovalProcedures, displaySold, displayBuy, minMoney, minProportion, maxProportion) => {
    return axiosServer({
        method: "post",
        url: "/buyControl/update",
        data: {
            procedures, selfRemovalProcedures, displaySold, displayBuy, minMoney, minProportion, maxProportion
        }
    });
};
/**
 * 商品审核
 * @param id
 * @param type
 * @param startTime
 * @param endTime
 * @returns {Promise<AxiosResponse<any>> | *}
 */
export const shopAudit = (id, type, startTime, endTime) => {
    return axiosServer({
        method: "post",
        url: "/buy/examine",
        data: {
            id, type, startTime, endTime
        }
    });
}
/**
 * 强制驳回商品
 * @param id
 * @returns {*}
 */
export const shopOverrule = (id) => {
    return axiosServer({
        method: "post",
        url: "/buy/compulsoryRejection",
        params: {
            id
        }
    });
}

/**
 * 金币市场分页查询（后台）
 * @param {*} type // 审核状态，默认待审核为0，审核通过为1，未通过为-1，下架-2（自动下架或自主下架）,已经通过后强制驳回-3
 * @param {*} businessAuthentication 
 * @param {*} page 
 * @param {*} limit 
 * @returns 
 */
export const buyMoneyListData = (type, businessAuthentication, page, limit) => {
    return axiosServer({
        method: "get",
        url: "/buyMoney/listData",
        params: {
            type, businessAuthentication, page, limit
        }
    });
}
/**
 * 金币市场商品审核（后台）
 * @param {*} id 
 * @param {*} type // 审核状态，默认待审核为0，审核通过为1，未通过为-1，下架-2（自动下架或自主下架）,已经通过后强制驳回-3
 * @returns 
 */
export const buyMoneyExamine = (id, type) => {
    return axiosServer({
        method: "post",
        url: "/buyMoney/examine",
        params: {
            id, type
        }
    });
}
// 强制驳回
export const buyMoneyOverrule = (id) => {
    return axiosServer({
        method: "post",
        url: "/buyMoney/compulsoryRejection",
        params: {
            id
        }
    });
}
/**
 * 金币市场详情查询（皆可）
 * @param {*} id 
 * @returns 
 */
export const buyMoneyDetails = (id) => {
    return axiosServer({
        method: "get",
        url: "/buyMoney/examine/" + id,
    });
}
/**
 * 金币市场日志查询（后台）
 * @param buyId 买家id
 * @param page
 * @param limit
 * @returns {*}
 */
export const buyMoneyLog = (buyId, page, limit) => {
    return axiosServer({
        method: "get",
        url: "/buyMoneyLog/listData",
        params: {
            buyId, page, limit
        }
    });
}
